﻿@model Dictionary<Site3AI.Models.QizSubject, IEnumerable<Site3AI.Models.QizSession>>
@{
    ViewBag.Title = "常规随访单";
    ViewBag.Back = "/";    
}
<div data-role="navbar">
    <ul>
        <li>@Html.ActionLink("我的随访", "Hist", new { Source = "常规随访单" }, new { @class = (Request["Source"] == "指标库" ? "" : "ui-btn-active site-nav-active ui-shadow") })</li>
        <li>@Html.ActionLink("我的检查单", "Hist", new { Source = "指标库" }, new { @class = (Request["Source"] != "指标库" ? "" : "ui-btn-active site-nav-active ui-shadow") })</li>
    </ul>
</div>

@if (ViewBag.RecordCount < 1)
{
    <p class="data-empty">您还没有随访记录！</p>
}
else
{
    <div id="qizsessionlist" data-role="collapsible-set" data-inset="false" data-corners="false">
        @foreach (var kv in Model)
        {                                        
            <div data-role="collapsible" @(!String.IsNullOrEmpty(Request["SubjectID"]) && kv.Key.ID == Request["SubjectID"] ? "data-collapsed=false" : "") data-inset="false" data-corners="false">
                <h2>@kv.Key.Title</h2>
                <ul data-role="listview" data-inset="false" data-corners="false">
                    @{
            int i = 0;   
                    }
                    @foreach (var qs in kv.Value.OrderByDescending(s => s.Timemark))
                    {
                        string currentUrl = Request.Path + "?";
                        if (String.IsNullOrEmpty(Request["SubjectID"]))
                        {
                            if (Request.QueryString != null && Request.QueryString.Count > 0)
                            {
                                currentUrl += String.Format("{0}&SubjectID={1}#qs_{2}", Request.QueryString.ToString(), kv.Key.ID, qs.ID);
                            }
                            else
                            {
                                currentUrl += String.Format("SubjectID={0}#qs_{1}", kv.Key.ID, qs.ID);
                            }
                        }
                        else
                        {
                            var queryString = Request.QueryString != null && Request.QueryString.Count > 0
                                ? Request.QueryString.ToString() : "";
                            if (queryString != "")
                            {
                                queryString = queryString.Substring(0, queryString.IndexOf("SubjectID="));
                                currentUrl += String.Format("{0}&SubjectID={1}#qs_{2}", queryString, kv.Key.ID, qs.ID);
                            }
                            else
                            {
                                currentUrl += String.Format("SubjectID={0}#qs_{1}", kv.Key.ID, qs.ID);
                            }
                        }            
                        <li>

                            <table class="timetable">
                                <tr>
                                    <td class="timemark">&nbsp;</td>
                                    <td class="timeline">&nbsp;</td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td class="timemark">
                                        <h2>@qs.Timemark.ToString("M月")</h2>
                                        <span>@qs.Timemark.ToString("yyyy年")</span>
                                    </td>
                                    <td class="timeline">
                                        <img src="/Content/images/@(qs.SessionAutoEvaluation == "异常" ? "arrow-red.png" : "arrow-green.png")" width="14" height="25"/>
                                    </td>
                                    <td class="sfcard @(qs.SessionAutoEvaluation == "异常" ? "redcard" : "greencard") ui-overlay-shadow">
                                        <a name="qs_@qs.ID" style="padding:0px; text-align:left;vertical-align:top;box-shadow:none; background-color:transparent;border-style:none;" data-role="button" 
                                            href="@Url.Action("QizSessionEdit", new { SubjectID = qs.QizSubjectID, ID = qs.ID, PreviewOnly = true, Back = currentUrl })">

                                            <h3>@Html.DisplayFor(model => qs.QizSubject.Hospital.HospName) </h3>
                                            <p style="font-weight: bold">@Html.DisplayFor(model => qs.QizSubject.Department.BingQu.Title)&nbsp;&nbsp;
                                            @Html.DisplayFor(model => qs.QizSubject.Department.DepName)
                                            </p>
                                            <p>
                                                <span>检查时间：@(qs.Timemark.ToString("yyyy-MM-dd"))</span>
                                                @if (qs.SessionAutoEvaluation == "异常")
                                                {
                                                    <br />
                                                    <span>自动诊断结果：异常</span>
                                                }
                                            </p>
                                        </a>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="timemark">&nbsp;</td>
                                    <td class="timeline">&nbsp;</td>
                                    <td>&nbsp;</td>
                                </tr>
                            </table>
                        </li>  
                                                i++;
                    }
                </ul>
            </div>
        }
    </div>       
}
@section Scripts{
    <style>
        .timetable {
            width: 98%;
            border: none;
            border-collapse: collapse;
            margin: 0px;
        }

            .timetable tr {
                margin: 0px;
            }

            .timetable td {
                margin: 0px;
                vertical-align: top;
            }

        .timemark {
            width: 60px;
            /*height:200px;
            display:block;
            float:left;*/
            text-align: right;
            padding: 10px 0px 0px 0px;
        }

            .timemark h2 {
                font: bold 1.6em/1em "微软雅黑" !important;
            }

            .timemark span {
                font: normal 0.8em/1em "微软雅黑";
            }

        .timeline {
            background: url(/Content/Images/vertical-red.png) repeat-y;
            width: 14px;
            padding: 30px 0px 0px 3px;
            /*min-height: 5px;
            width:3px; 
            height:220px;
            margin-top:-20px;
            left:70px;
            display:block;
            float:left;            
            position:absolute;
            z-index:10;*/
        }

        .sfcard {
            /*width:208px;
            height:147px;
            display:block;
            float:left;
            padding-left:25px;
            margin:0px 0px 0px 10px;*/
            padding: 10px 10px 0px 10px;
        }

            .sfcard a {
                text-decoration: none;
            }

        .greencard {
            /*background:url(/Content/Images/sfcard-green.png) no-repeat;*/
            background: #a7d30f;
        }

        .graycard {
            /*background:url(/Content/Images/sfcard-gray.png) no-repeat;*/
            background: #ebebe9;
        }

        .redcard {
            background: #e93854;
            color: #fff;
        }

            .redcard h3, .redcard a, .redcard p, .redcard span {
                color: #fff;
            }

        .ui-listview > .ui-li-static {
            padding: 0 0 0 0.4em;
            border: none;
        }
    </style>
}